<?php
/**
 * Class representation of the HTML <input type="hidden" /> tag. It can be added to containers.
 *
 * @author Niels Janssen
 * @since 2008-07-08
 * @package Form.Elements
 */
class InputHidden extends FormElement {

	function __construct( $name, $value = null, $properties = array ( ) ) {
		parent::__construct( $name, array_merge ( array( 'value' => $value ), $properties ) );
	}

	public function __toString() {
		$html = '';

		foreach ( $this->properties as $key => $property ) {
			if ( substr ( $key, 0, 5 ) == 'html_' ) {
				$html .= ' '.substr ( $key, 5 ).'="'.$property.'"';
			}
		}

		return '<input type="hidden" name="' . ( $this->getFormName() != '' ? $this->getFormName() . '_' : '' ) . $this->name . '" id="' . ( $this->getFormName() != '' ? $this->getFormName() . '_' : '' ) . $this->name . '" value="' . $this->value . '"'.$html.' />';
	}
}

?>